import { message } from "ant-design-vue";
import axios from "axios";

const config = {
  baseURL:'http://112.54.164.78:8080',
  timeout:1000,
}
const instance = axios.create(config)

instance.interceptors.request.use((config)=>{
  const token = localStorage.getItem('token')
  if(token){
    config.headers.Authorization = `Bearer ${token}`
  }
  return config
},(err)=>{
  message.error('请求失败,位置:请求拦截器')
  return err
})

export const getUserInfoAPI = ()=>instance.get('/user/info')


export const editUserInfoAPI = (params:any)=>instance.put('/user/info',params)

export default instance;


